<% # @page_title="Issues" %>
<% @mselect_issues=1 %>
<% @table = @issues %>
<% @action = "index" %>
<% @cont = "issues" %>

<%= render :partial => 'layouts/page_count' %>

<table>
<thead>
  <tr>
    <th scope="col">
      <%= sort_link("Test Area", "session_test_area") %>
      <%= filterx_icon("Remove filter on #{session[:test_area]}", session[:test_area], :test_area, {:controller => 'test_areas', :action => 'set', :id => 'all'}) %>
    </th>

    <th scope="col"><%= sort_link("Host", "ip_address") %>
      <%= filterx_icon("Remove filter on host", @url_params[:host_id_v], :host_id_v, {:controller => @cont}) %>
    </th>

    <th scope="col"><%= sort_link("Port", "port") %>
      <%= filterx_icon("Remove filter on port #{@url_params[:port_v]}", @url_params[:port_v], :port_v, {:controller => @cont}) %>
    </th>

    <th scope="col"><%= sort_link("Trans Proto", "transport_protocol") %>
      <%= filterx_icon("Remove filter on #{@url_params[:trans_v]}", @url_params[:trans_v], :trans_v, {:controller => @cont}) %>
    </th>

    <th scope="col"><%= sort_link("Issue", "issue_shortname") %>
      <%= filterx_icon("Remove filter on issue #{@url_params[:issue_v]}", @url_params[:issue_v], :issue_v, {:controller => @cont}) %>
    </th>

  </tr>
</thead>

<tbody>
<%
odd_or_even = 0
for issue in @issues
    odd_or_even = 1 - odd_or_even
    # <td><= link_to issue.ip_address, issue.host ></td>
%>
  <tr class="odd<%=h odd_or_even %>">
    <td><%=h issue.test_area_name %>
        <%= filter_icon("Show only #{issue.test_area_name}", session[:test_area], {:controller => 'test_areas', :action => 'set', :id => issue.test_area_id}) %>
    </td>

    <td>
      <%= link_to_host(issue.ip_address, {:controller => 'issues', :action => 'index', :host_id_v => issue.host_id}) %>
      <%= filter_icon("Show only #{issue.ip_address}", @url_params[:host_id_v], {:controller => 'issues', :host_id_v => issue.host_id}) %>
    </td>

    <% if issue.port.nil? then %>
      <td><i>N/A</i></td>
      <td><i>N/A</i></td>
    <% else %>

      <td>
        <%=h issue.port.port %>
        <%= filter_icon("Show only port #{issue.port.port}", @url_params[:port_v], {:controller => 'issues', :port_v => issue.port.port}) %>
      </td>

      <td>
        <%=h issue.transport_protocol_name %>
        <%= filter_icon("Show only #{issue.transport_protocol_name} ports", @url_params[:trans_v], {:controller => 'issues', :trans_v => issue.transport_protocol_name}) %>
      </td>

    <% end %>

    <td>
      <%=h issue.issue_shortname %>
      <%= filter_icon("Show only #{issue.issue_shortname} issue", @url_params[:issue_v], {:controller => 'issues', :issue_v => issue.issue_shortname}) %>
    </td>

  </tr>
<% end %>
</tbody>
</table>

<%= render :partial => 'layouts/page_count' %>
